#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include <fstream>
#include<string>
#include <cstdio>
using namespace std;


int main()
{
	FILE* fp, * out;
	fp = fopen("test.txt", "r");
	char str[200];
	char c;
	int i = 1;
	while ((c = fgetc(fp)) != EOF) {

		string filename = "file_" + std::to_string(i) + ".txt";
		ofstream file(filename);
		i++;
		while (',' != c) {
			file << c;
		}

	}


	/*while (!feof(fp))
	{
		if()
	}*/
	fclose(fp);
}


